home *** CD-ROM | disk | FTP | other *** search
- Path: howland.reston.ans.net!agate!parsons
- From: parsons@vouvray.CS.Berkeley.EDU (David C. Parsons)
- Newsgroups: comp.lang.c++
- Subject: Need help with derived class template
- Date: 28 Jan 1996 08:16:31 GMT
- Organization: University of California, Berkeley
- Message-ID: <4efbcv$ovo@agate.berkeley.edu>
- NNTP-Posting-Host: vouvray.cs.berkeley.edu
-
- I am trying to write a class template which is derived from another
- class template, and unfortunately can't seem to get the syntax right.
- I've looked through the FAQ and my C++ books (Stroustrup, Lippman) and
- can't find a discussion of this anywhere.
-
- The base class definition looks like this:
-
- template <class Type>
- class Base { ... }
-
- The compile errors arise from the derived class definition. Here are
- the variations I've tried, and the errors they generate:
-
- 1. template <class Type>
- class Derived : public Base { ... }
-
- ==> parse error before `{'
-
- 2. template <class Type>
- class Derived : public Base<Type> { ... }
-
- ==> base class `Base<double>' has incomplete type
-
- 3. template <class Type>
- class Derived<Type> : public Base<Type> { ... }
-
- ==> Internal compiler error.
- Please submit a full bug report to `bug-g++@prep.ai.mit.edu'.
-
- Any suggestions? Incidentally, the base class by itself works fine,
- and the inheritance works if I remove the templating (i.e. instantiate
- it "by hand" to a particular type).
-
- Many thanks in advance --
-
- David Parsons
- CS gradual student
- UC Berkeley
-